﻿using System.ComponentModel.Composition;
using System.Threading;
using System.Windows;
using MefBasic.Helper;

namespace MefBasic
{
    public class MainWindowPresenter:APresenter<IMainWindow>
    {
        public MainWindowPresenter(IMainWindow view)
            :base(view)
        {
            ShellPresenter = MefApplication.Bootstrapper.Container.GetExportedValue<ShellPresenter>();
            MefApplication.Bootstrapper.Container.ComposeExportedValue(this);
            SynchronizationContextHelper.Instance.SetContext(SynchronizationContext.Current);
        }

        public ShellPresenter ShellPresenter
        {
            get { return (ShellPresenter)GetValue(ShellPresenterProperty); }
            set { SetValue(ShellPresenterProperty, value); }
        }

        public static readonly DependencyProperty ShellPresenterProperty =
            DependencyProperty.Register("ShellPresenter", typeof(ShellPresenter), typeof(MainWindowPresenter), new UIPropertyMetadata(null));


        public string Title
        {
            get { return (string)GetValue(TitleProperty); }
            set { SetValue(TitleProperty, value); }
        }

        public static readonly DependencyProperty TitleProperty =
            DependencyProperty.Register("Title", typeof(string), typeof(MainWindowPresenter), new UIPropertyMetadata(null));


    }
}